home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 November / Macworld (1999-11).dmg / Updaters / WhiteCap 3.0.4 / WhiteCap Source.sit / WhiteCap Source / Common / General Tools / Headers / Printable.h < prev    next >
C/C++ Source or Header  |  1999-07-19  |  2KB  |  66 lines

  1. #pragma once
  2.  
  3. #ifndef _Printable_
  4. #define _Printable_
  5.  
  6.  
  7. class ZafPrinter;
  8.  
  9.  
  10. class Printable {
  11.  
  12.  
  13.     public:
  14.         //  inOption == 0:     Std print    (print setup dialog)
  15.         //    inOption == 1:    Def Print    (uses most recent record from JobSetup() )
  16.         //    inOption == 2:    Print One     (no print setup and just print one)
  17.         virtual bool                    Print( char* inJobName, int inOption );
  18.         
  19.         //    Post:    Returns the hDC (Win32) of the printer.
  20.         static void*                    GetPrintDevice();
  21.         
  22.         //    Post:    Returns the length in pages needed to print.
  23.         virtual long                    GetNumPages() = 0;
  24.         
  25.         //    Post:    This must be called at the end/exit of the program.
  26.         static void                        Shutdown();
  27.         
  28.         //    Util to bring up the page setup dialog box.
  29.         static bool                        PageSetup();
  30.         
  31.         //    Post:    Returns the dimentions, in points, of the current paper size
  32.         static void                        GetPagePointSize( long& outWidth, long& outHeight );
  33.         
  34.         //    Post:    Brings up the print job setup dialog and uses that iff inOption == 1 in Print()
  35.         //    Note:    Returns <true> if user doesn't cancel the dialog box.
  36.         static bool                        JobSetup();
  37.  
  38.         //    Post:    This draws itself to the current device
  39.         virtual void                    DrawPage( long inPageNum, long inX, long inY ) = 0;
  40.  
  41.         //    Post:    Routes DrawPage output to <inDevice>
  42.         //    Note:    If on win32 <inDevice> is a hDC, and on MacOS it's a GrafPortPtr. 
  43.         virtual void                    SetPrintDevice( void* inDevice );    
  44.         
  45.         //    Post:    Releases all ties to the current print device
  46.         virtual void                    CloseOutputPort();
  47.         
  48.         static void                        InvalidePRec()  { sJobIsSetup = false; }
  49.         
  50.                     
  51.     protected:
  52.         void*                            mCurPrintDevice;
  53.         static char                        sJobRecord[ 500 ];
  54.     
  55.  
  56.     private:
  57.         static ZafPrinter*                sZafPrinter;
  58.         static bool                        sJobIsSetup;            // true id print rec is valid
  59.  
  60.         void                            AssertInit();
  61.  
  62.  
  63.         static void                     InitJobStruct( void* inJobPtr, long inNumPages );
  64. };
  65.  
  66. #endif